package com.imooc.pojo.bo;

import com.imooc.common.exception.ValidateException;
import com.imooc.common.result.AbstractRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName: UserBO
 * @description: 用户对象BO
 * @author: limx
 * @create: 2019-12-21 15:06
 **/
@Data
@ApiModel(value = "用户对象BO", description = "从客户端，由用户传入的数据封装在此entity中")
public class UserBO extends AbstractRequest {

    @ApiModelProperty(value = "用户名", name = "username", example = "imooc", required = true)
    private String username;
    @ApiModelProperty(value = "密码", name = "password", example = "123456", required = true)
    private String password;
    @ApiModelProperty(value = "确认密码", name = "confirmPassword", example = "123456", required = false)
    private String confirmPassword;

    @Override
    public void requestCheck() {
        if (StringUtils.isBlank(username) ||
                StringUtils.isBlank(password) ||
                StringUtils.isBlank(confirmPassword)) {
            throw new ValidateException(
                    333,
                    "用户和密码不能为空");
        }

    }
}
